#pragma once
#include <string>
namespace xpam
{
    namespace serialization
    {
        template<class T>
        class named_type
        {
        public:
            T & value;
            std::string name;
            named_type(T & v, const std::string & n) : value(v), name(n)
            { }
        };

        template<class T>
        named_type<T> naming(T & t, const std::string & n)
        {
            return named_type<T>(t, n);
        };

        template<class STORAGE, class T>
        void serialize(STORAGE & s, named_type<T> & t)
        {
            s.push_name(t.name);
            serialize(s, t.value);
            s.pop_name();
        }

    }
}